package main;

//CPU.java  
public class CPU {  
 private int speed;  

 public int getSpeed() {  
     return speed;  
 }  

 public void setSpeed(int speed) {  
     this.speed = speed;  
 }  
}  
/*
//HardDisk.java  
public class HardDisk {  
 private int amount; // 通常这里会用更大的单位如GB, 但为了简化示例我们保持int类型  

 public int getAmount() {  
     return amount;  
 }  

 public void setAmount(int amount) {  
     this.amount = amount;  
 }  
}  

//PC.java  
public class PC {  
 private CPU cpu;  
 private HardDisk hardDisk; // 为了代码清晰，我将变量名从HD改为hardDisk  

 public void setCPU(CPU cpu) {  
     this.cpu = cpu;  
 }  

 public void setHardDisk(HardDisk hardDisk) {  
     this.hardDisk = hardDisk;  
 }  

 public void show() {  
     System.out.println("CPU Speed: " + cpu.getSpeed() + " MHz");  
     System.out.println("Hard Disk Capacity: " + hardDisk.getAmount() + " GB");  
 }  
}  

//Test.java  
public class Test {  
 public static void main(String[] args) {  
     // 创建CPU对象并设置速度  
     CPU cpu = new CPU();  
     cpu.setSpeed(2200); // 这里假设单位是MHz，实际应用中可能需要更具体的单位处理  

     // 创建HardDisk对象并设置容量  
     HardDisk hardDisk = new HardDisk();  
     hardDisk.setAmount(200); // 这里假设单位是GB  

     // 创建PC对象  
     PC pc = new PC();  

     // 设置PC的CPU和HardDisk  
     pc.setCPU(cpu);  
     pc.setHardDisk(hardDisk);  

     // 显示CPU速度和硬盘容量  
     pc.show();  
 }  
}*/